#include "mainwindow.h"
#include "ui_mainwindow.h"

#include <QInputDialog>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_entry_clicked()
{
    QStringList list;
    list.push_back("item1");
    list.push_back("item2");
    list.push_back("item3");
    list.push_back("item4");
    QString item = QInputDialog::getItem(this, "条目输入对话框", "请输入条目: ", list);
    ui->label->setText(item);
}

void MainWindow::on_pushButton_float_clicked()
{
    double result = QInputDialog::getDouble(this, "浮点数输入对话框", "请输入一个浮点数: ");
    ui->label->setText(QString::number(result));
}

void MainWindow::on_pushButton_int_clicked()
{
    int result = QInputDialog::getInt(this, "整数输入对话框", "请输入一个整数: ");
    ui->label->setText(QString::number(result));
}
